import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/layout/layoutIndex.vue'
import Login from '@/views/login/loginIndex.vue'
import Homes from '@/views/HomeIndex/HomeIndex.vue'

const Product = ()=>import('@/views/product/productIndex.vue');
const List = ()=>import('@/views/product/list/listIndex.vue');
const Category = ()=>import('@/views/product/category/catgoryIndex.vue');

const Order = ()=>import('@/views/order/orderIndex.vue');
const OrderList = ()=>import('@/views/order/orderlist/orderlistIndex.vue');
const CollectIndex = ()=>import('@/views/order/collect/collectIndex.vue');
const Advert = ()=>import('@/views/advert/advertIndex.vue')
const AdvertList =() =>import('@/views/advert/advertList/advertListIndex.vue')


Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    component:Layout,
    children:[
      {
        path:'/',
        name:'HomeIndex',
        component:Homes
      },
      {
        path:'/product',   //产品
        name:'product',
        component:Product,
        children:[
          {
            path:'list',
            name:'list',
            component:List
          },
          {
            path:'category',
            name:'category',
            component:Category
          }
        ]
      },
      {
        path:'/order',
        name:'order',
        component:Order,
        children:[
          {
              path:'orderlist',
              name:'orderlist',
              component:OrderList
          },
          {
            path:'collect',
            name:'collect',
            component:CollectIndex
          }
        ]
      },
      {
        path:'/advert',   //产品
        name:'advert',
        component:Advert,
        children:[
          {
            path:'advertlist',
            name:'advertlist',
            component:AdvertList
          }
        ]
      }
      
    ]
  },
  {
    path:'/login',
    name:'login',
    component:Login
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
